﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Swirebev.PhotoDownload.Model;
using System.Data.SqlClient;
using Swirebev.PhotoDownload.Common;
using System.Reflection;

namespace Swirebev.PhotoDownload.DAL
{
	public class LocationDataAccess
	{
		public static string GetSalesCenterByRoute(string routeId)
		{
			string _connectionString = Settings.Instance.ConnectionString;
			try
			{
				using (SqlConnection connection = new SqlConnection(_connectionString))
				{
					connection.Open();
					SqlCommand comd = new SqlCommand();
					comd.Connection = connection;
					comd.CommandType = System.Data.CommandType.StoredProcedure;
					comd.CommandText = "M_mECS_GetSalesCenterByRoute_S";

					comd.Parameters.Add("@RouteId", SqlDbType.NVarChar);
					comd.Parameters["@RouteId"].Value = "0018";
					return comd.ExecuteScalar().ToString();
				}
			}
			catch (Exception ex)
			{
				Log.Error(MethodBase.GetCurrentMethod().DeclaringType, "取营业所时出错", ex);
				return string.Empty;
			}

		}
	}
}
